<!--
 * @Descripttion: 
 * @version: 
 * @Author: cyj
 * @Date: 2022-12-08 23:28:38
-->
<template>
    <div class="song-rank">
        <Official v-if="rankOfficial.length !== 0" :rankOfficial="rankOfficial"></Official>
        <Globe v-if="rankGlobe.length !== 0" :rankGlobe="rankGlobe"></Globe>
    </div>
</template>

<script setup>
import { getAllRank } from '../../../api/findmusic/singrank/singrank'
import Official from '../songrank/chirdren/Official.vue'
import Globe from '../songrank/chirdren/Globe.vue'
// import { useDiscover } from '../../../store/discovermusic'
import { onMounted, ref } from 'vue'
// const discover = useDiscover()
let rankOfficial = ref([])
let rankGlobe = ref([])

//获取排行榜数据
async function getAllRanks() {
    let res = await getAllRank()
    if (res.status === 200) {
        let allRankInfo = res.data.list
        rankOfficial.value = allRankInfo.slice(0, 4)
        rankGlobe.value = allRankInfo.slice(4, allRankInfo.length)
    }
}

onMounted(() => {
    getAllRanks()
})
</script>

<style lang="scss" scoped>
.song-rank {}
</style>